import Net from "../../common/net/Net";
import TipUi from "../tip/TipUi";
import Model from "../../common/model/Model";
import BaseDialog from "../base/BaseDialog";

const {ccclass, property} = cc._decorator;

@ccclass
export default class AccountRenameDialog extends BaseDialog {
    public modelName: string = "account";
    public uiName: string = "AccountRenameDialog";

    @property(cc.EditBox)
    nicknameEditBox:cc.EditBox=null;

    start () {
        this.nicknameEditBox.string = Model.model.account.nickname || Model.model.account.username;
    };
    okButtonClick(){
        Net.request(
            "connector.entryHandler.rename",
            {nickname:this.nicknameEditBox.string},
            (data)=>{
                TipUi.instance.showTip("修改成功");
                this.node.destroy();
            }
        );
    };
}
